/*
 * @Author: zhouwei wei.zhou@flip.fun
 * @Date: 2024-04-28 10:21:01
 * @LastEditors: zhouwei wei.zhou@flip.fun
 * @LastEditTime: 2024-04-28 11:54:37
 * @FilePath: /redux-tooltik/src/App.jsx
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { useState } from 'react'
import reactLogo from './assets/react.svg'
import viteLogo from '/vite.svg'
import { useSelector, useDispatch } from 'react-redux'
import './App.css'
import { add, addCountAsync, getNumberSelector } from './store/user'

function App() {
	const [count, setCount] = useState(0)
	const number = useSelector(getNumberSelector)
	const dispatch = useDispatch()
	const addNumber = () => {
		dispatch(add(1))
	}
	return (
		<div className='card'>
			<button onClick={() => addNumber()}>count is {number}</button>
			<button
				onClick={() => {
					dispatch(addCountAsync(12222)).then(res => {
						console.log(res, 111)
					})
				}}
			>
				异步
			</button>
		</div>
	)
}

export default App
